StageRunCustomBuild,
StageLibraries,
StageBinaries,
- StageTests,
+ StageLibraryTests,
+ StageBinaryTests,
}
type Message = (PackageId, TargetStage, Freshness, CargoResult<()>);
// do not depend on dev-dependencies.
StageBinaries => vec![(id, StageLibraries)],
- // Tests depend on all non-transitive dependencies
- // (dev-dependencies) in addition to the library stage for this
- // package.
- StageTests => {
- let mut base = vec![(id, StageLibraries)];
- base.extend(deps.filter(|&(_, dep)| !dep.is_transitive())
- .map(|(id, _)| (id, StageLibraries)));
+ // Tests depend on all dependencies (including dev-dependencies) in
+ // addition to the library stage for this package. Note, however,
+ // that library tests only need to depend the custom build command
+ // being run, not the libraries themselves.
+ StageBinaryTests | StageLibraryTests => {
+ let mut base = if stage == StageBinaryTests {
+ vec![(id, StageLibraries)]
+ } else {
+ vec![(id, StageRunCustomBuild)]
+ };
+ base.extend(deps.map(|(id, _)| (id, StageLibraries)));
base
}
}
//
// Each target has its own concept of freshness to ensure incremental
// rebuilds on the *target* granularity, not the *package* granularity.
- let (mut libs, mut bins, mut tests) = (Vec::new(), Vec::new(), Vec::new());
+ let (mut libs, mut bins, mut lib_tests, mut bin_tests) =
+ (Vec::new(), Vec::new(), Vec::new(), Vec::new());
let (mut build_custom, mut run_custom) = (Vec::new(), Vec::new());
for &target in targets.iter() {
if target.get_profile().is_custom_build() {
target.get_profile().is_test(),
target.get_profile().is_custom_build()) {
(_, _, true) => &mut build_custom,
- (_, true, _) => &mut tests,
- (true, _, _) => &mut libs,
- (false, false, _) if target.get_profile().get_env() == "test" => &mut tests,
+ (true, true, _) => &mut lib_tests,
+ (false, true, _) => &mut bin_tests,
+ (true, false, _) => &mut libs,
+ (false, false, _) if target.get_profile().get_env() == "test" => &mut bin_tests,
(false, false, _) => &mut bins,
};
for (work, kind) in work.into_iter() {
jobs.enqueue(pkg, jq::StageLibraries, libs);
jobs.enqueue(pkg, jq::StageBinaries, bins);
- jobs.enqueue(pkg, jq::StageTests, tests);
+ jobs.enqueue(pkg, jq::StageBinaryTests, bin_tests);
+ jobs.enqueue(pkg, jq::StageLibraryTests, lib_tests);
Ok(())
}